const express = require('express');
const asyncHandler = require('express-async-handler');
const basicImplController = require('../controllers/basic.controller.impl')
const router = express.Router();
module.exports = router;

router.post('/getAllMachineInfos', asyncHandler(getAllMachineInfos))
router.post('/getMachineInfosBySerialNumber', asyncHandler(getMachineInfosBySerialNumber))
router.post('/addMachineInfos', asyncHandler(addMachineInfos))
router.post('/updateMachineInfos', asyncHandler(updateMachineInfos))
router.post('/deleteMachineInfos', asyncHandler(deleteMachineInfos))
router.post('/updateEquipmentHistory', asyncHandler(updateEquipmentHistory))

async function getAllMachineInfos(req, res) {
    let result = await basicImplController.getAllMachineInfos(req.body)
    res.json(result)
}

async function getMachineInfosBySerialNumber(req, res) {
    let result = await basicImplController.getMachineInfosBySerialNumber(req.body)
    res.json(result)
}

async function addMachineInfos(req, res) {
    let result = await basicImplController.initMachineInfos(req.body)
    res.json(result)
}

async function updateMachineInfos(req, res) {
    let result = await basicImplController.updateMachineInfos(req.body)
    res.json(result)
}


async function deleteMachineInfos(req, res) {
    let result = await basicImplController.deleteMachineInfos(req.body)
    res.json(result)
}


async function updateEquipmentHistory(req, res) {
    let result = await basicImplController.updateEquipmentHistory(req.body)
    res.json(result)
}
